package nginx

import "time"

type BaseInfo struct {
	Id           string    `json:"id"`
	Name         string    `json:"name"`
	WorkDir      string    `json:"workDir"`
	ExecPath     string    `json:"execPath"`
	CreateDate   time.Time `json:"createDate"`
	UpdateDate   time.Time `json:"updateDate"`
	ConfigDetail Config    `json:"configDetail"`
}

type Config struct {
	BasicConfigs []Directive  `json:"basicConfigs"`
	Http         HttpConfig   `json:"http"`
	Stream       StreamConfig `json:"stream"`
	Id           string       `json:"id"`
}

type TestConfig struct {
	Config
	StreamInclude string
	HttpInclude   string
}

type Directive struct {
	Code  string `json:"code"`
	Value string `json:"value"`
}

type HttpServerConfig struct {
	Server          string           `json:"server"`
	Port            int              `json:"port"`
	BasicConfigs    []Directive      `json:"basicConfigs"`
	LocationConfigs []LocationConfig `json:"locationConfigs"`
}

type LocationConfig struct {
	Uri          string      `json:"uri"`
	Modifier     string      `json:"modifier"`
	BasicConfigs []Directive `json:"basicConfigs"`
}

type UpstreamConfig struct {
	Name         string      `json:"name"`
	BasicConfigs []Directive `json:"basicConfigs"`
}

type HttpConfig struct {
	BasicConfigs   []Directive        `json:"basicConfigs"`
	ServerConfig   []HttpServerConfig `json:"serverConfig"`
	UpstreamConfig []UpstreamConfig   `json:"upstreamConfig"`
}
type StreamConfig struct {
	BasicConfigs   []Directive          `json:"basicConfigs"`
	UpstreamConfig []UpstreamConfig     `json:"upstreamConfig"`
	ServerConfig   []StreamServerConfig `json:"serverConfig"`
}

type StreamServerConfig struct {
	Listen       string      `json:"listen"`
	BasicConfigs []Directive `json:"basicConfigs"`
}
